import { _decorator, Component, Node, Collider, ITriggerEvent } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('CubeAComp')
export class CubeAComp extends Component {

    private collider: Collider = null;

    private moveSpeed = 10;

    start() {
        this.collider = this.node.getComponent(Collider);
        this.collider.on('onTriggerEnter', this.onTriggerEnter, this);
        this.collider.on('onTriggerExit', this.onTriggerExit, this);
        this.collider.on('onTriggerStay', this.onTriggerStay, this);
    }

    update(deltaTime: number) {

    }

    public onTriggerEnter(event: ITriggerEvent) {
        console.log('onTriggerEnter==============');

    }

    public onTriggerExit(event: ITriggerEvent) {
        console.log('onTriggerExit========');

    }

    public onTriggerStay(event: ITriggerEvent) {
        console.log('onTriggerStay========');

    }

}

